package org.jeecg.modules.htxincailiao.crawler.job;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.DateUtils;
//import org.jeecg.modules.htxincailiao.crawler.processor.XinCaiLiaoOnlinePageProcessor;
import org.jeecg.modules.htxincailiao.crawler.processor.GuangfuPageProcessor;
import org.jeecg.modules.htxincailiao.crawler.processor.OfWeekPageProcessor;
import org.quartz.*;

import javax.annotation.Resource;

@PersistJobDataAfterExecution
@DisallowConcurrentExecution
@Slf4j
public class Crawler implements Job {

//    @Resource
//    private XinCaiLiaoOnlinePageProcessor onlinePageProcessor;

    @Resource
    private OfWeekPageProcessor ofWeekPageProcessor;


    @Resource
    private GuangfuPageProcessor guangfuPageProcessor;


    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {

        OfWeekPageProcessor.create(this.ofWeekPageProcessor);
        GuangfuPageProcessor.create(this.guangfuPageProcessor);

//        SearchCcgpPageProcessor.create(this.searchCcgpPageProcessor);

//        log.info(String.format(" info 爬虫定时 Crawler !  时间:" + DateUtils.getTimestamp()));
////        log.info(JSONObject.toJSONString(onlinePageProcessor));
//
//        if (onlinePageProcessor == null){
////            log.info("Init XinCaiLiaoOnlinePageProcessor");
//            System.out.printf("\n\n\n %s \n\n\n", JSONObject.toJSONString("Init  Crawler  XinCaiLiaoOnlinePageProcessor"));
//            this.onlinePageProcessor = new XinCaiLiaoOnlinePageProcessor();
//        XinCaiLiaoOnlinePageProcessor.create( this.onlinePageProcessor);
//        }

    }
}
